#pragma once
#include "GameUIWindow.h"

#define GRID_NUM 10

class CGameTestWnd2 : public CGameUIWindow
{	

public:
	CGameTestWnd2(void);
	~CGameTestWnd2(void);

	void OnCreate();
	void OnDraw();

	bool OnChildMsg(ChildMsg eMsgType,const string& rkChildName,const string& rkUserData /* = "" */);
	bool OnLeftBtnDown(int iX,int iY);

	bool OnClickBtn1(const string& rkUserData);
	bool OnClickBtn2(const string& rkUserData);
	bool OnClickBtn3(const string& rkUserData);
	bool OnClickBtn4(const string& rkUserData);

protected:
	void RefreshGrids();
	void CalPath();
	bool CanStep(int iIndex);
	bool IsDeadStep(int iIndex);
	int GetNextIndex(int iCurIndex,int iDirection);
	int GetNextStep(int iCurIndex);

private:
	CMyImage kImage;

	bool m_abGrid[GRID_NUM][GRID_NUM];
	vector<int> m_aiPath;
	vector<int> m_aiStep;
	DWORD m_dwStartCalPathTime;
	int m_iCurIndex;
};

void CreateTestWnd2(const string& rkName,int iX,int iY,int iWidth,int iHeigth,const string& kUserData = "");